﻿using System;

namespace Borg
{
    [AttributeUsage(AttributeTargets.Interface, AllowMultiple=true, Inherited=false)]
    public class ParamDefinitionAttribute : Attribute
    {
        public string Name { get; internal set; }
        public Type Type { get; internal set; }
        public string TypeName { get; internal set; }
        public object DefaultValue { get; set; }

        public ParamDefinitionAttribute(string name, Type type)
            : this(name, type, ParamDefinition.NoDefault)
        { }

        public ParamDefinitionAttribute(string name, string typeName)
            : this(name, typeName, ParamDefinition.NoDefault)
        { }

        public ParamDefinitionAttribute(string name, Type type, object defaultValue)
            : this(name, string.Format("{0}, {1}", type.FullName, type.Assembly.FullName), defaultValue)
        {
            Type = type;
        }

        public ParamDefinitionAttribute(string name, string typeName, object defaultValue)
        {
            Name = name;
            TypeName = typeName;
            DefaultValue = defaultValue;
        }
    }
}
